from django.shortcuts import render
from django.views import View

from home.models import Articlecategory, Article


# Create your views here.
class IndexView(View):
    def get(self, request):
        categories = Articlecategory.objects.all()
        articles = Article.objects.all()
        for item in articles:
            print(item.id)
            print(item.title)
            print(item.content)
            print(item.sumary)
        context = {
            'categories': categories,
            'articles': articles,
        }
        return render(request, 'index.html', context=context)